home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <clib/exec_protos.h>
- #include <stdio.h>
- #include <stdlib.h>
-
- void *AllocVMem (ULONG size, ULONG attributes); /* d0, d1 */
- void FreeVMem (void *block, ULONG size); /* a1, d0 */
- ULONG AvailVMem (ULONG attributes); /* d1 */
-
- #pragma libcall VMBase AllocVMem 1E 1002
- #pragma libcall VMBase FreeVMem 24 0902
- #pragma libcall VMBase AvailVMem 2A 101
-
- struct Library *VMBase;
-
- main (void)
-
- {
- ULONG *buffer;
-
- if ((VMBase = OpenLibrary ("vmm.library", 0L)) == NULL)
- {
- printf ("Couldn't open vmm.library\n");
- exit (5);
- }
-
- printf ("VM available: %ld\n", AvailVMem (0L));
- buffer = AllocVMem (1000L, MEMF_CLEAR);
- printf ("Allocated mem at %lx\n", buffer);
- printf ("VM available: %ld\n", AvailVMem (0L));
- FreeVMem (buffer, 1000L);
- printf ("VM available: %ld\n", AvailVMem (0L));
- printf ("Largest block: %ld\n", AvailVMem (MEMF_LARGEST));
- CloseLibrary (VMBase);
- exit (0);
- }
-